Extract BaseRegistrationFormBuilder to share fields across form types#1301
Draft
Extract BaseRegistrationFormBuilder to share fields across form types#1301
Conversation
…ion forms - Add confirm email field with server-side match validation - Group email, confirm email, and email type in one row - Label as "Email" on short forms, "Primary Email" when secondary exists - Add address type (Home/Work) on same row as street address - Add consent and training interest questions (appear on all forms) - Skip storing confirmation field value in user form submissions Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Short, Extended, and Scholarship form builders now inherit from a common base class that provides shared helpers (add_header, add_field) and reusable field sections (basic contact, scholarship, consent). This eliminates duplication and ensures changes to shared fields propagate to all form types. Also fixes three bugs: - Email confirmation key mismatch (primary_email_confirmation → confirm_email) so validation now works for extended forms - workshop_settings → workshop_environments so professional tags get assigned - confirm_email responses no longer stored redundantly in PersonForm Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…dmin CRUD - Replace 4 hardcoded builders (Base, Short, Extended, Scholarship) with a single FormBuilderService that accepts selectable sections - Rename PersonForm → FormSubmission and PersonFormFormField → FormAnswer (tables, models, and all references) - Add admin FormsController with section interstitial (new) and field editor (edit) with drag-reorder via existing sortable_controller - Snapshot question_text on FormAnswer at submission time for answer preservation when fields are later deleted - Add form-level hide_answered_person_questions and hide_answered_form_questions booleans for conditional field visibility - Add sections JSON column to forms to record builder configuration - Keep form_fields.status column (still used by workshop logs/reports) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
maebeale
commented
Mar 9, 2026
| return | ||
| end | ||
|
|
||
| @form_fields = @form.form_fields.where(status: :active).reorder(position: :asc) |
Collaborator
Author
There was a problem hiding this comment.
removing status from form_fields bc now they'll either be on the form or removed, no need for soft delete
maebeale
commented
Mar 9, 2026
|
|
||
| @person_form = @form.person_forms.find_by(person: person) | ||
| unless @person_form | ||
| @form_submission = @form.form_submissions.find_by(person: person) |
Collaborator
Author
There was a problem hiding this comment.
changing name from person_forms to form_submissions
maebeale
commented
Mar 9, 2026
| @form_fields = @form.form_fields.where(status: :active).reorder(position: :asc) | ||
| @responses = @person_form.person_form_form_fields.index_by(&:form_field_id) | ||
| @form_fields = @form.form_fields.reorder(position: :asc) | ||
| @responses = @form_submission.form_answers.index_by(&:form_field_id) |
Collaborator
Author
There was a problem hiding this comment.
changing responses from person_form_form_fields to form_answers
maebeale
commented
Mar 9, 2026
| rename_column :form_answers, :person_form_id, :form_submission_id | ||
|
|
||
| # Add question_text snapshot to form_answers (preserves question at submission time) | ||
| add_column :form_answers, :question_text, :string |
Collaborator
Author
There was a problem hiding this comment.
adding question_text as field on form_answers to store/cache the question at time of having answered the form
The standalone registration forms are dev/test data, not required for production bootstrapping. Placed before event seeds that depend on them. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Links to the public registration page of the first event using this form, opening in a new tab. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Renders a disabled preview of the form as it would appear to a registrant. Works for all forms, including those not linked to events. Accessible from both the forms index and the form editor. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Use the same text-sm text-gray-500 hover:text-gray-700 px-2 py-1 pattern in a right-aligned flex-wrap container. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Consent is an opt-in acknowledgment, not a yes/no choice. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Allows changing which builder sections are included on an existing form. Unchecking a section removes its fields; checking adds default fields at the end. Preserves existing answers via question_text snapshots. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Use explicit SECTION_HEADERS mapping to remove headers by question text instead of by field_group, which failed when sections shared a group (e.g. person_identifier and person_contact_info both use "contact"). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…elds - Rename event_feedback section to marketing with updated field keys - Add three-category conditional visibility: Scholarship-only, Logged out only, Answers on file (covers professional + marketing groups) - Add slide toggle previews on form show page - Group-aware drag-and-drop: dragging a section header moves all its fields - Switch to cocoon for adding/removing fields (replaces server-side add_field) - Style section headers as bold text, indent child fields - Replace Delete checkbox with Remove link (matching affiliation pattern) - Fix nested form issue (button_to inside form_with) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add visibility column (always_ask, scholarship_only, logged_out_only, answers_on_file) to form_fields with migration - Update FormBuilderService with GROUP_VISIBILITY defaults per section - Replace visibility_select_controller with generic chip_select_controller that accepts styles via Stimulus values - Update public_registrations_controller to filter by visibility column instead of hardcoded field_group arrays - Update form show/edit views to derive toggle conditions from visibility - Fix new cocoon fields not saving: reject_if blank question on new records - Add validation error display to form edit page Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Both were created but never added to the controller index, so they weren't loading on the page. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add `one_time` boolean to form_fields for cross-form answer hiding - Two-tier answer hiding: one-time checks all forms, regular checks within event - Switch field rows to flexbox with wrap for responsive layout - Make section header names editable text fields - New cocoon fields now append to bottom of form field list - Add ONE_TIME_GROUPS to FormBuilderService for professional/background sections Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is the goal of this PR and why is this important?
How did you approach the change?
BaseRegistrationFormBuilderwith shared helpers (add_header,add_field) and reusable field sections (build_basic_contact_fields,build_scholarship_fields,build_consent_fields)primary_email_confirmationbut controller validation checkedconfirm_email— confirmation match validation was silently skipped for extended formsworkshop_settingsvsworkshop_environments: Builder createdworkshop_settingsbut the service and helper looked forworkshop_environments— professional tags were never assignedsave_form_fieldsskippedprimary_email_confirmationbut notconfirm_email— short form stored confirmation email unnecessarilynew.html.erbto support 3-column layout (email | confirm | type) when all three fields existUI Testing Checklist
Anything else to add?
AuthenticatedEventRegistrationFormBuildercan inherit the same shared sections and add its own fields.🤖 Generated with Claude Code